<template>
  <ul class="list">
    <li class="item" v-for="item in letters" :key="item" @click="clickLetter">{{item}}</li>
  </ul>
</template>

<script>
export default {
  name: 'cityAlphabet',
  props: {
    cities: Object
  },
  computed: {
    letters () {
      const letters = []
      for (let i in this.cities) {
        letters.push(i)
      }
      return letters
    }
  },
  methods: {
    clickLetter (e) {
      this.$emit('change', e.target.innerText)
    }
  }
}
</script>

<style lang="stylus" scoped>
  .list
    display flex
    flex-direction column
    justify-content center
    position: absolute
    top: 1.58rem
    bottom 0
    right 0
    width .4rem
    .item
      line-height .44rem
      text-align center
      color green
</style>
